<?php
include_once 'php/lib/lib.php';
Common::init_website();
$id=$_GET['id'];
$query="SELECT * FROM tbl_news WHERE id=$id";
$row=Db::mysql_query($query,Config::$FETCH_MODE_ROW);
$query="SELECT `title`,`id` FROM tbl_news WHERE id>$id-3 AND id<$id+3 AND id<>$id ORDER BY id DESC LIMIT 6";
$other_rows=Db::mysql_query($query,Config::$FETCH_MODE_TABLE);
ob_start();
?>

<table class="contentpaneopen">
	<tbody>
		<tr>
			<td class="contentheading" width="100%"><?php echo $row['title']?></td>
			<td class="buttonheading" align="right" width="100%"><?php echo A_PRINT;?></td>
			<td class="buttonheading" align="right" width="100%"><?php echo A_MAIL;?></td>			
		</tr>
	</tbody>
</table>

<table class="contentpaneopen">
	<tbody>
		<tr>
			<td valign="top">
				<span class="small"><?php echo WRITE_BY?></span>
			</td>
		</tr>
		<tr>
			<td class="createdate" valign="top"><?php echo "Ngày ".date('d.m.Y',$row['create_time']);?></td>
		</tr>
		<tr>
			<td valign="top">
				<?php echo $row['content'];?>
				<?php if(count($other_rows)>0){?>
				<div style="margin-left:10px; margin-right:0px;padding-right:5%;padding-left:5%;padding-top:30px;border-top:1px solid rgb(204,204,204); text-align:left;clear:both">
					<div id="neweritemtitle">Các tin liên quan:</div>
					<ul id="neweritemlist">
						<?php foreach ($other_rows as $key=>$other_row){?>
						<li><span class="extranews_date"><?php echo $key+1?></span> - <span ><a href="?id=<?php echo $other_row['id']?>"><?php echo $other_row['title']?></a></span></li>
						<?php }?>												
					</ul>
					<?php READON("Xem tất cả...","../tin-tuc.php" )?>
				</div>
				<?php }?>
			</td>
		</tr>
	</tbody>
</table>

<?php 
$params[2] = ob_get_contents();
$params[1] = $row['title'];
$params[0] = $row['quote'];
ob_end_clean();
include_once 'php/layout.php';
?>  